﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System.Collections.Generic;
using System.Windows.Controls;
using FinPlusCommon;

namespace FinPlusWPFControls
{
    public partial class FinPlusDockPanel : FinPlusControl
    {
        public override string[] States { get { return new string[] { "Height", "Width", "Left", "Top" }; } }
        public override string[] TestStates { get { return new string[] { "TestString", "IsValid", "ChildrenCount" }; } }
        public override IFunctions Adaptor { get { return base.Children(dockPanel.Children); } }
        public override string TestString { get { return Adaptor.ToString(); } }
        public int ChildrenCount { get {return dockPanel.Children.Count; } }

        //construct
        public FinPlusDockPanel(IDictionary<string, IFinPlusComp[]> controls)
        {
            InitializeComponent();

            foreach (var dock in controls)
                foreach (var control in dock.Value)
                    if(control.GetType().Equals(typeof(FinPlusStatusBar)))
                        statusBar.Children.Add(DockSet((UserControl)control, dock.Key));
                    else
                        dockPanel.Children.Add(DockSet((UserControl)control, dock.Key)); 

            IsValid = true;
        }

        //common control interface
        public override void Dock(object control, string dock)
        {
            dockPanel.Children.Add(DockSet((UserControl)control, dock));
        }
     }
}

